home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / common / switch_player.c4 < prev   
Text File  |  2002-09-09  |  3KB  |  93 lines

  1.       
  2. {
  3.   @switch_player {
  4.     resid CurPlayer;
  5.     resid OtherPlayer;
  6.     resid Player1ID;
  7.     resid Player2ID;
  8.     resid Game;
  9.  
  10.     Game   = ResByName("Game"); 
  11.     CurPlayer = ResPropGetResID(Game,"game_cur_player");
  12.  
  13.     
  14.     /* if this is only a one player game. we are done */
  15.     if (ResPropGetInt(Game,"game_num_players") == 1) {
  16.       stop;
  17.     }
  18.     
  19.     /* pull out the player ids */
  20.     Player1ID = ResPropGetResID(Game,"player_1_id");
  21.     Player2ID = ResPropGetResID(Game,"player_2_id");
  22.  
  23.     /* get other player */
  24.     if (CurPlayer != Player1ID) {
  25.       OtherPlayer = Player1ID;
  26.     } else {
  27.       OtherPlayer = Player2ID;    
  28.     }    
  29.  
  30.     /* if the player we are switching to is done, we are done. */
  31.     /* but only if the dash is visible because otherwise it was the button that was pressed */
  32.     if(ResPropGetInt(ResByName("dash.gl"), "Hidden") == FALSE){
  33.       if (ResPropGetInt(OtherPlayer,"player_destination_arrived") == 1) {
  34.         stop;
  35.       }
  36.     }    
  37.     
  38.     /* do all the things we need to do to prep for next player */
  39.     AudioStop(ResPropGetInt(CurPlayer,"truck_wiper_sound_id"));
  40.     AudioStop(ResPropGetInt(CurPlayer,"truck_engine_sound_id"));
  41.     AudioStop(ResPropGetInt(CurPlayer,"truck_radio_sound_id"));
  42.     
  43.     /* switch the players */
  44.     ResPropSetResID(Game,"game_cur_player",OtherPlayer);
  45.     
  46.     /* i call these to keep sane */    
  47.     /* set the temperature */
  48.     ResParseEvent(ResByName("common/set_temperature.c4"),"@set_temperature");
  49.  
  50.     /* if its raining or snowing */
  51.     ResParseEvent(ResByName("common/set_rain_snow.c4"),"@set_rain_snow");      
  52.     
  53.     /* set night day */
  54.     ResParseEvent(ResByName("common/set_night_day.c4"),"@set_night_day");
  55.  
  56.     /* set the segment controller to at city */
  57.     ResPropSetInt(ResByName("dash.gl/SegmentController"),"state",7);
  58.  
  59.     /*--------TODO: COMMENT THIS SECTION----------*/
  60.     ResParseEvent(ResByName("map.gl/map"), "@update");
  61.     ResPropSetInt(ResByName("map.gl"),"Hidden",FALSE);   
  62.     ResPropSetInt(ResByName("map.gl"),"Hidden",TRUE);
  63.     ResPropSetInt(ResByName("photo_album.gl"),"Hidden",FALSE);   
  64.     ResPropSetInt(ResByName("photo_album.gl"),"Hidden",TRUE);
  65.     ResPropSetInt(ResByName("travel_log.gl"),"Hidden",FALSE);   
  66.     ResPropSetInt(ResByName("travel_log.gl"),"Hidden",TRUE);
  67.     ResPropSetInt(ResByName("dispatch.gl"),"Hidden",TRUE);
  68.     ResPropSetInt(ResByName("dispatch.gl"),"Hidden",FALSE);
  69.     ResPropSetResID(ResByName("laptop.gl/dispatch"), "RadioGroupSelectedID", ResByName("laptop.gl/dispatch")); 
  70.     ResParseEvent(ResByName("laptop.gl/dispatch"),"@activate");  
  71.     if (ResPropGetInt(ResByName("dash.gl"), "Hidden") == FALSE) {
  72.       ResParseEvent(ResByName("common/hide_show.c4"),"@SHOW_TABS");
  73.       ResParseEvent(ResByName("dash.gl/GPS"),"@activate");
  74.     }
  75.     /*------------------*/
  76.     
  77.     /* reset the time since last player switch */
  78.     ResPropSetInt(Game,"game_time_last_player_switch",
  79.       ResPropGetInt(
  80.         ResPropGetResID(Game,"game_cur_player"),
  81.         "time_now"
  82.       )
  83.     );        
  84.    
  85.     /* show the fullscreen player switch screen */
  86.     ResPropSetInt(ResByName("switch_player.gl"),"Hidden",FALSE);
  87.  
  88.     
  89.     
  90.   }    
  91. }      
  92.       
  93.